#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    int removeDuplicates(vector<int>& nums) {
        int count = 0;
        vector<int>::iterator it = nums.begin();
        ++it;
        while (it != nums.end())
        {
            if (*it == *(it - 1))
            {
                nums.erase(it);
            }
            else
            {
                ++count;
                ++it;
            }
        }
        return count;
    }
};

int main()
{
    Solution s;
    vector<int> vi;
    vi.push_back(1);
    vi.push_back(1);
    vi.push_back(2);
    vi.push_back(3);
    vi.push_back(3);
    vi.push_back(3);
    int i = s.removeDuplicates(vi);
    cout << i << endl;
    return 0;
}